﻿@{
    ViewBag.Title = "运行记录";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section scripts{
    <script src="~/Areas/Dev/ViewModels/Dev.viewModel.searchEdit.js" type="text/javascript"></script>
    <script type="text/javascript">
    using(['validatebox','combobox','combotree','numberbox','datebox'],easyuifix.datagrid_editor_extend);
        using(['lookup'],easyuifix.datagrid_editor_extend);
        var  viewModel =function(){
            var self = this;
            Dev.viewModel.searchEdit.apply(this, arguments);
             
            this.addClick = function(){
                var pKey = data.idField;
                com.ajax({
                    type: 'GET',
                    url: self.urls.billno,
                    success: function (d) {
                        var row = $.extend({ Yxjl_BillNo: d }, self.defaultRow);
                        self.gridEdit.addnew(row);
                    }
                });
            };
        };
        var data = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
        ko.bindingViewModel(new viewModel(data));
    </script>
}
<div class="z-toolbar">
    <a id="a_refresh" href="#" plain="true" class="easyui-linkbutton" icon="icon-arrow_refresh" title="刷新" data-bind="click:refreshClick">刷新</a>
    <a id="a_add" href="#" plain="true" class="easyui-linkbutton" icon="icon-add" title="新增" data-bind="click:addClick">新增</a>
    <a id="a_edit" href="#" plain="true" class="easyui-linkbutton" icon="icon-edit" data-bind="click:editClick" title="编辑">编辑</a>
    <a id="a_save" href="#" plain="true" class="easyui-linkbutton" icon="icon-save" data-bind="click:saveClick" title="保存">保存</a>
    <a id="a_del" href="#" plain="true" class="easyui-linkbutton" icon="icon-cross" title="删除" data-bind="click:deleteClick">删除</a>
    <a id="a_audit" href="#" plain="true" class="easyui-linkbutton" icon="icon-user-accept" data-bind="click:auditClick" title="审核">审核</a>

</div>

<div id="condition" class="container_12" style="position:relative;">
    <div class="grid_1 lbl">运行单号</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.Yxjl_BillNo" class="z-txt " /></div>
    <div class="grid_1 lbl">设备编号</div>
     <div class="grid_2 val"><input type="text" data-bind="lookupValue:form.Yxjl_Sbbh" class="z-txt easyui-lookup" data-options="lookupType:'sbda',multiple:false"/></div>
    <div class="clear"></div>
    <div class="grid_1 lbl">录入人</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.CreatePerson" class="z-txt" /></div>
    <div class="grid_1 lbl">录入日期</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.CreateDate" class="z-txt easyui-datebox" /></div>
    <div class="clear"></div>
    <div class="prefix_9" style="position:absolute;top:5px;height:0;">
        <a id="a_search" href="#" class="button button-blue" style="margin:0 15px;" data-bind="click:searchClick">查询</a>
        <a id="a_reset" href="#" class="button button-blue" data-bind="click:clearClick">清空</a>
    </div>
</div>

<table id="gridlist" data-bind="datagrid:grid">
    <thead>
        <tr>
           <th field="_ID" hidden = "true" ></th>
            <th field="Yxjl_BillNo" sortable="true"   editor="text" align="left" width="90">单据编号</th>
            <th field="Yxjl_Sbbh"   editor="{type:'lookup',options:{lookupType:'sbda',required:true}}" sortable="true" align="left"    width="120"   >设备编号    </th> 
            <th field="Sbda_Sbmc"  sortable="true"    align="left" width="150">设备名称</th>
            <th field="Sbda_Ggxh"  sortable="true"    align="left" width="130">规格型号</th>
            <th field="Yxjl_Jlrq"  sortable="true" editor="datebox" formatter="com.formatDate" align="left" width="100">记录日期</th>
            <th field="Yxjl_Zdts"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="60">制定台时</th>

            <th field="Yxjl_Yxts"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="60">运行台时</th>
            <th field="Yxjl_Tjqk"  sortable="true"  editor="text" align="left" width="130">停机情况</th>
            <th field="Yxjl_Tjyy"  sortable="true"  editor="text" align="left" width="150">停机原因</th>
            <th field="Yxjl_Tjts"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="60">停机台时</th>

            <th field="Yxjl_Jhcl"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="60">计划产量</th>
            <th field="Yxjl_Sjcl"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="60">实际产量</th>
            <th field="Yxjl_Scnl"  sortable="true"  editor="{type:'numberbox',options:{precision:2}}" align="right" width="80">生产能力</th>
            <th field="Yxjl_Sbzt"  sortable="true"   align="center" width="80" editor="{type: 'combobox', options:{data:data.dataSource.sbztItems}}" >设备状态</th>
            <th field="Yxjl_Remark"  sortable="true"  editor="text" align="left" width="100">备注说明</th>
            <th field="UpdatePerson"  sortable="true"  align="left" width="80">更新人</th>
            <th field="ApproveState"  sortable="true"  align="left" width="80">确认状态</th>
        </tr>
    </thead>
</table>